package com.smz.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.smz.dao.SettlementDAO;
import com.smz.entity.Settlement;
import com.smz.entity.TShipping;
import com.smz.service.SettlementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SettlementServiceImpl extends ServiceImpl<SettlementDAO, Settlement> implements SettlementService {
    @Autowired
    private SettlementDAO settlementDAO;

    @Override
    public IPage<Settlement> findSettlementPage(int current, int size) {
        return settlementDAO.findSettlementPage(new Page(current,size));
    }

    @Override
    public int count(String settlementStatus) {
        return settlementDAO.count(settlementStatus);
    }

    @Override
    public IPage<Settlement> findSettlementNumber(int current, int size , int freightId) {
        return settlementDAO.findSettlementNumber(new Page(current,size),freightId);
    }

    @Override
    public void updateSettlement(String status,int id) {
        TShipping tShipping = new TShipping();
        settlementDAO.updateSettlement(new Settlement(0,id, status, tShipping));
    }
}
